package com.humngyang.com.hmy.study.springtest.mybatis;

import com.humngyang.com.hmy.study.springtest.mybatis.HmyConfig;
import com.humngyang.com.hmy.study.springtest.mybatis.UserService;
import org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class TestMybatis {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(HmyConfig.class);
        applicationContext.getBean(UserService.class).getAllUser();



////                关闭默认的单例模式
//        AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext();
//        ac.register(HmyConfig.class);
////        获取beanFactory然后将单例模式关闭
//        AbstractAutowireCapableBeanFactory aac = (AbstractAutowireCapableBeanFactory) ac.getAutowireCapableBeanFactory();
//        aac.setAllowCircularReferences(false);
//
//        ac.refresh();
//        ac.getBean(UserService.class).getAllUser();
//        ac.getBean(RoleService.class).getAllRole();
    }

}
